package com.example.eureka2;

import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

/**
 * Create by jian.pan on 2018/6/19
 */
@Component
public class FilterTest extends OncePerRequestFilter {

  Logger logger  = LoggerFactory.getLogger(FilterTest.class);

  @Override
  protected void doFilterInternal(HttpServletRequest httpServletRequest,
      HttpServletResponse httpServletResponse, FilterChain filterChain) {
    logger.info("进入filter");
    try {
      filterChain.doFilter(httpServletRequest,httpServletResponse);
    } catch (IOException e) {
      e.printStackTrace();
    } catch (ServletException e) {
      e.printStackTrace();
    }
  }

}
